<div class="card wallet-card h-100">  
    <div class="card-body">  
        <div class="d-flex justify-content-between align-items-center mb-3">  
            <h5 class="card-title mb-0">  
                <i class="fas fa-{{ wallet.icon }} me-2"></i>  
                {{ wallet.name }}  
            </h5>  
            {% if show_actions %}  
            <div class="dropdown">  
                <button class="btn btn-sm btn-light" type="button" id="dropdownMenu-{{ wallet.id }}" data-bs-toggle="dropdown" aria-expanded="false">  
                    <i class="fas fa-ellipsis-v"></i>  
                </button>  
                <ul class="dropdown-menu" aria-labelledby="dropdownMenu-{{ wallet.id }}">  
                    <li><a class="dropdown-item" href="{% url 'wallet_edit' wallet.id %}">编辑</a></li>  
                    <li><a class="dropdown-item" href="{% url 'transaction_add' %}?wallet={{ wallet.id }}">添加交易</a></li>  
                    <li><a class="dropdown-item" href="{% url 'transaction_list' %}?wallet={{ wallet.id }}">查看交易</a></li>  
                    <li><hr class="dropdown-divider"></li>  
                    <li><a class="dropdown-item text-danger" href="{% url 'wallet_delete' wallet.id %}">删除</a></li>  
                </ul>  
            </div>  
            {% endif %}  
        </div>  
        
        {% if show_updated_at %}  
        <p class="card-subtitle text-muted mb-4">上次更新: {{ wallet.last_updated|date:"Y-m-d H:i" }}</p>  
        {% endif %}  
        
        <div class="d-flex justify-content-between mb-3">  
            <div>  
                <small class="text-muted d-block">初始金额</small>  
                <span>¥{{ wallet.initial_balance|floatformat:2 }}</span>  
            </div>  
            <div class="text-end">  
                <small class="text-muted d-block">当前余额</small>  
                <span class="fw-bold {% if wallet.current_balance >= 0 %}text-success{% else %}text-danger{% endif %}">  
                    ¥{{ wallet.current_balance|floatformat:2 }}  
                </span>  
            </div>  
        </div>  
        
        {% if show_progress %}  
        <div class="progress" style="height: 8px;">  
            {% if wallet.current_balance >= 0 %}  
                {% if wallet.initial_balance > 0 %}  
                    <div class="progress-bar bg-success" role="progressbar"   
                         style="width: {{ wallet.current_balance|divide:wallet.initial_balance|multiply:100|min:100 }}%"   
                         aria-valuenow="{{ wallet.current_balance|divide:wallet.initial_balance|multiply:100|min:100|floatformat:0 }}"   
                         aria-valuemin="0"   
                         aria-valuemax="100"></div>  
                {% else %}  
                    <div class="progress-bar bg-success" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>  
                {% endif %}  
            {% else %}  
                <div class="progress-bar bg-danger" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>  
            {% endif %}  
        </div>  
        {% endif %}  
        
        {% if wallet.warning_balance > 0 and wallet.current_balance < wallet.warning_balance %}  
        <div class="alert alert-warning mt-3 mb-0 py-2 small">  
            <i class="fas fa-exclamation-triangle me-1"></i> 余额低于预警值 (¥{{ wallet.warning_balance|floatformat:2 }})  
        </div>  
        {% endif %}  
    </div>  
    
    {% if show_footer %}  
    <div class="card-footer bg-transparent">  
        <div class="btn-group w-100">  
            <a href="{% url 'transaction_add' %}?wallet={{ wallet.id }}&type=income" class="btn btn-sm btn-outline-success">  
                <i class="fas fa-plus me-1"></i> 收入  
            </a>  
            <a href="{% url 'transaction_add' %}?wallet={{ wallet.id }}&type=expense" class="btn btn-sm btn-outline-danger">  
                <i class="fas fa-minus me-1"></i> 支出  
            </a>  
        </div>  
    </div>  
    {% endif %}  
</div>